# 解决多参数 urlencode：  通过 parse.urlencode(data) 实现
from urllib import request,parse
url="https://www.baidu.com/s?"
data={
    'wd':'周杰伦',
    'sex':'男',
    'location':'中国台湾'
}
headers={
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
}
print(parse.urlencode(data))
datastr=parse.urlencode(data)
url=url+datastr
req=request.Request(url=url,headers=headers)
response=request.urlopen(req)
content=response.read().decode("utf-8")
print(content)